package main

import (
	"fmt"
	"io/ioutil"
)

func main() {
	copyFile()
}

func copyFile() {
	sourceFilePath := "d:/go_write.txt"
	tarFilePath := "d:/copy.txt"

	file, err := ioutil.ReadFile(sourceFilePath)
	if err != nil {
		fmt.Println("读取文件出现错误")
		return
	}
	err = ioutil.WriteFile(tarFilePath, file, 0666)
	if err != nil {
		fmt.Println("写入文件失败")
	}
}
